import request from '@/utils/request'

export function getAuditStatusNoPage() {
  return request({
    url: '/flow/leaf/noPage',
    method: 'get'
  })
}

export function addAudit(audit) {
  return request({
    url: '/flow/audit/add',
    method: 'post',
    data: audit
  })
}

export function pageAudit(pageNum, pageSize) {
  return request({
    url: '/flow/audit/page/' + pageNum + '/' + pageSize,
    method: 'get'
  })
}

export function searchFormCacheListAudit() {
  return request({
    url: '/flow/audit/searchFormList',
    method: 'get'
  })
}

export function initReportLeaf(reportId) {
  return request({
    url: '/flow/audit/initAddLeaf/' + reportId,
    method: 'post'
  })
}

export function updateReportLeaf(reportLeaf, statusNum) {
  return request({
    url: '/flow/audit/updateLeaf/' + statusNum,
    method: 'put',
    data: reportLeaf
  })
}

export function backReportLeaf(reportLeaf) {
  return request({
    url: '/flow/audit/backLeaf',
    method: 'post',
    data: reportLeaf
  })
}

export function submitAudit(reportId, userId) {
  return request({
    url: '/flow/audit/submitAudit',
    method: 'get',
    params: { reportId, userId }
  })
}

export function stampAudit(reportId, userId) {
  return request({
    url: '/flow/audit/stampAudit',
    method: 'get',
    params: { reportId, userId }
  })
}

export function auditRecordList(id, pageNum, pageSize) {
  return request({
    url: '/flow/audit/getReportRecordList/' + id,
    method: 'get',
    params: { pageNum, pageSize }
  })
}

export function myReportAuditList(userId, pageNum, pageSize) {
  return request({
    url: '/flow/audit/myReportPage/' + pageNum + '/' + pageSize,
    method: 'get',
    params: { userId }
  })
}

export function auditToFile(reportLeaf) {
  return request({
    url: '/flow/audit/file',
    method: 'post',
    data: reportLeaf
  })
}

export function auditPassReport(reportId, userId) {
  return request({
    url: '/flow/audit/passReport',
    method: 'get',
    params: { reportId, userId }
  })
}
export function auditTerminationReport(reportId, userId) {
  return request({
    url: '/flow/audit/rejectReport',
    method: 'get',
    params: { reportId, userId }
  })
}

export function searchFlowPoolPage(searchObj, userId, pageNum, pageSize) {
  return request({
    url: '/flow/audit/search/' + pageNum + '/' + pageSize,
    method: 'post',
    data: searchObj,
    params: { userId }
  })
}

export function myReportListSearch(userId, pageNum, pageSize, searchObj) {
  return request({
    url: '/flow/audit/myReportSearch',
    method: 'post',
    params: { userId, pageNum, pageSize },
    data: searchObj
  })
}

export function getMyReportList(userId, pageNum, pageSize) {
  return request({
    url: '/flow/audit/getMyReport/' + userId,
    method: 'get',
    params: { pageNum, pageSize }
  })
}

export function searchMyFlowPoolPage() {}

export function downloadReportRecord(reportId) {
  return request({
    url: '/flow/audit_record/download_record',
    method: 'get',
    params: { reportId },
    responseType: 'blob'
  })
}
